<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', 'Auth\AuthController@getLogin');
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// 访客页面
Route::group(['middleware' => 'role:guest|user|operator|admin'], function() {
    // TODO: 访客页面
      Route::get('/user/getReset','Role\UsersController@alter');//修改密码
      Route::post('/user/getReset','Role\UsersController@doalter');
});

// 前台页面
Route::group(['middleware' => 'role:user|operator|admin'], function() {
    Route::get('/home', function () {
        return view('home');
    });
    // TODO: 前台页面
});

// 后台页面
Route::group(['middleware' => 'role:operator|admin'], function() {
    Route::get('/console', function () {
        return view('console');
    });
    // TODO: 后台页面
});

// 系统管理员页面
Route::group(['middleware' => 'role:admin'], function() {
    Route::resource('/console/users', 'Role\UsersController', ['except' => ['show', 'destroy']]);
    Route::get('/console/users/{users}/delete', 'Role\UsersController@delete');
    Route::resource('/console/roles', 'Role\RolesController', ['except' => ['show', 'destroy']]);
    Route::get('/console/roles/{roles}/delete', 'Role\RolesController@delete');
    Route::resource('/console/permissions', 'Role\PermissionsController');
    // TODO: 系统管理员页面
});